pygrub: Set path in #! line of pygrub, too
authorKeir Fraser <keir.fraser@citrix.com>
Tue, 25 Aug 2009 13:57:45 +0000 (14:57 +0100)
committerKeir Fraser <keir.fraser@citrix.com>
Tue, 25 Aug 2009 13:57:45 +0000 (14:57 +0100)
pygrub currently has a hardcoded path of /usr/bin/python which is not
correct if the version of python at install time is not the same as
that at build time.  This patch uses the existing install-wrap and
python/get-path machinery.

(It does not address the currently-existing bug that the get-path
machinery works by assuming that `python' is a symlink, rather than
querying the python interpreter for its version.)

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
tools/Rules.mk
tools/misc/Makefile
tools/pygrub/Makefile
tools/pygrub/src/pygrub

index 53434d51fc331ae6d14beef353948ac7e2f909e4..ae7bf0e3164f63d04187ca15959665a146bec893 100644 (file)
@@ -49,6 +49,11 @@ check-$(CONFIG_X86) = $(call cc-ver-check,CC,0x030400,\
                         "Xen requires at least gcc-3.4")
 $(eval $(check-y))
 
+DEFAULT_PYTHON_PATH := $(shell $(XEN_ROOT)/tools/python/get-path)
+PYTHON_PATH ?= $(DEFAULT_PYTHON_PATH)
+INSTALL_PYTHON_PROG = \
+       $(XEN_ROOT)/tools/python/install-wrap "$(PYTHON_PATH)" $(INSTALL_PROG)
+
 %.opic: %.c
        $(CC) $(CPPFLAGS) -DPIC $(CFLAGS) -fPIC -c -o $@ $<
 
index 07a09708fe453c560096262f367812782150436c..d60997181300d7c2372ec7ed4aefa0444277d57a 100644 (file)
@@ -26,11 +26,6 @@ INSTALL_SBIN-y := xm xen-bugtool xen-python-path xend xenperf xsview xenpm xen-t
 INSTALL_SBIN-$(CONFIG_X86) += xen-hvmctx
 INSTALL_SBIN := $(INSTALL_SBIN-y)
 
-DEFAULT_PYTHON_PATH := $(shell $(XEN_ROOT)/tools/python/get-path)
-PYTHON_PATH ?= $(DEFAULT_PYTHON_PATH)
-INSTALL_PYTHON_PROG = $(XEN_ROOT)/tools/python/install-wrap \
-"$(PYTHON_PATH)" $(INSTALL_PROG)
-
 .PHONY: all
 all: build
 
index b8b64a7794b7acd07848ea6b756315963634a1b4..49abed06d138dc4c153429241cb6d67f940e504e 100644 (file)
@@ -12,6 +12,7 @@ build:
 install: all
        CC="$(CC)" CFLAGS="$(CFLAGS)" $(PYTHON) setup.py install \
                $(PYTHON_PREFIX_ARG) --root="$(DESTDIR)" --force
+       $(INSTALL_PYTHON_PROG) src/pygrub $(DESTDIR)/$(BINDIR)/pygrub
        $(INSTALL_DIR) $(DESTDIR)/var/run/xend/boot
 
 .PHONY: clean
index f386e2303642e7588c51ac114fb06298435efac8..dd35a185363cfd213eb33428d7fe8c9c4a4c4499 100644 (file)
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#! /usr/bin/env python
 #
 # pygrub - simple python-based bootloader for Xen
 #